package com.hhxy.stringbuilder;

public class Joint {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4};
        System.out.println(printArray(arr));
    }
    public static String printArray(int[] arr){
        if(arr != null){
            StringBuffer s = new StringBuffer("[");
            for (int i = 0; i <arr.length ; i++) {
                s.append(arr[i]).append(i==arr.length-1?"":",");
            }
            s.append("]");
            return s.toString();
        }else{
            return null;
        }
    }

}
